package com.hxzy.mapper;

import com.hxzy.entity.AddressBook;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
* @author admin
* @description 针对表【address_book(地址管理)】的数据库操作Mapper
* @createDate 2024-02-21 11:30:40
* @Entity com.hxzy.entity.AddressBook
*/
@Mapper
public interface AddressBookMapper extends BaseMapper<AddressBook> {

    @Update(value = "update address_book set is_default='1' where user_id=#{userId}")
    long cancelDefaultAddress(long userId);

    @Update(value = "update address_book set is_default='0' where user_id=#{userId} and id=#{addressId}")
    long enableDefaultAddress(@Param(value = "userId") long userId,@Param(value = "addressId") Long addressId);
}




